<html>
<head>
<title>LabelMe source code installation instructions</title>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE,NO-STORE,MUST-REVALIDATE" />
<META HTTP-EQUIV="imagetoolbar" CONTENT="no" />
</head>
<body>
 <script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<div id="Layer2" style="position:absolute; left:59px; top:41px; width:753px; height:561px; z-index:1"> 
  <p><a href="http://labelme.csail.mit.edu"><img src="http://labelme.csail.mit.edu/Icons/LabelMeNEWtight198x55.gif" border="0"></a></p>
  <p>Here you will find the source code to install the LabelMe <b>annotation
    tool</b> on your server (if you are looking for code to interact
    with the images and annotations, then please download the <a
    href="http://labelme.csail.mit.edu/LabelMeToolbox/index.html">Matlab toolbox</a> instead). LabelMe 
    is an annotation tool writen in Javascript for online image labeling. The 
    advantage with respect to traditional image annotation tools is that you can 
    access the tool from anywhere and people can help you to annotate your images 
    without having to install or copy a large dataset onto their computers. </p>
  <p><strong>REQUIREMENTS</strong></p>
  <p>You will need the following to set up the LabelMe tool on your
  web server:</p>

  <li>Run an Apache server (see special
  configuration instructions for <a href="#windows">Windows</a> or <a href="#ubuntu">Ubuntu</a>).</li>
  <li>Enable authconfig in Apache so that server side includes (SSI)
  will work.  This will allow SVG drawing capabilities.  This is the most common source
  of errors, so make sure this step is working.</li>
  <li>Allow perl/CGI scripts to run.</li>

  <p><strong>INSTALLATION FOR LINUX/WINDOWS</strong></p>
  <p>1. Download the <a href="LabelMe-1-113.tar.gz">LabelMe annotation tool source code</a>.</p>
  <p>2. (Optional) See special configuration instructions if you are
  installing on <a href="#windows">Windows</a> or <a href="#ubuntu">Ubuntu</a>.
  <p>3. You will need to make the following directories:</p>
  <p>&nbsp a. Images/<br>
    &nbsp b. Annotations/<br>
    &nbsp c. TmpAnnotations/</p>
  <p>4. Insert the images that you wish to label in &quot;Images&quot;. The images 
    must be organized into subdirectories (e.g., Images/folder1/*.jpg). The corresponding subdirectories 
    should also be created in the Annotations folder.</p>
  <p>5. Set the images to have read permissions on your web server and folders in 
    the &quot;Annotations&quot; folder to have write permissions.
    Also, &quot;TmpAnnotations&quot; needs to have write permissions.</p>
  <p>6. Modify the &quot;Makefile&quot; variables
    &quot;IMAGES_DIR&quot;, &quot;ANNOTATIONS_DIR&quot;, and &quot;TMP_ANNOTATIONS_DIR&quot; 
    to point to the above directories. Now, run &quot;make&quot;. This will set 
    up LabelMe.</p>
  <p>7. To use the tool, open in your browser: http://yourserver.edu/tool.html</p>
  <p>If you are not able to draw polygons, check to see if the page is
  loaded as an "application/xhtml+xml" page (you can see this in Firefox by
  navigating to Tools->Page Info).  If it is not, be sure that SSI are
  enabled (see above for enabling authconfig in Apache).

  <p><strong><a name="windows">WINDOWS CONFIGURATION (thanks to Juan Wachs and Mathias Kolsch for these instructions)</a></strong></p>
  <p>1. Install "Apache" for windows.</p>
  <p>2. Install "Active Perl".</p>
  <p>3. Install Cygwin.</p>
  <p>4. Make sure that all of the above (except LabelMe) works OK
  first.</p>
  <p>5. Change the config file of Apache (httpd.conf) by adding the
  following:</p>

<pre>
# Added by Juan from line 194
Options FollowSymLinks SymLinksIfOwnerMatch Indexes +Includes +ExecCGI
AllowOverride AuthConfig
AllowOverride All
Order allow,deny
Allow from all

# Added by Juan in line 325
Alias /LabelMe/ "C:/POSTDOC/LabelMe/"		

# Added and changed by Juan (line 338)
#ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"
ScriptAlias /cgi-bin/ "C:/POSTDOC/LabelMe/" 

# Changed line 406
AddHandler cgi-script .cgi .pl

# Added and changed in line 417
AddType text/html .shtml
AddHandler server-parsed .shtml
AddOutputFilter INCLUDES .shtml
</pre>

  <p>6. Add the module "mod_rewrite" to the Active Perl version.</p>
  <p>7. Change and add to the file "Makefile" the following:

<pre>
#IMAGES_DIR=/afs/csail/group/vision/www/data/LabelMe/Test/Images
#ANNOTATIONS_DIR=/afs/csail/group/vision/www/data/LabelMe/Test/Annotations

IMAGES_DIR=/cygdrive/c/POSTDOC/LabelMe/Images/
ANNOTATIONS_DIR=/cygdrive/c/POSTDOC/LabelMe/Annotations/
</pre>

  <p>8. Run the command "make" on Cygwin, under the folder
  "LabelMe".</p>
  <p>9. Change all the "#! /usr/bin/.." by "#!c:/Perl/bin/perl.exe"
  in all the scripts under LabelMe.</p>
  <p>10. Add/change the scipt "fetch_image.cgi". See below all the
  file after the changes</p>

<pre>
#!c:/Perl/bin/perl.exe
# Get STDIN:

read(STDIN,$collection,$ENV{'CONTENT_LENGTH'});

$fname = "DirLists/$collection.txt";

# Juan add:
if(!open(xFP,$fname)) {
    print "Status: 404\n\n";
    return;
}
$numlines = 0;
@lines = readline(xFP);
foreach $i (@lines) {
    $numlines = $numlines + 1;
};
close(xFP);
# end Juan add

if(!open(FP,$fname)) {
    print "Status: 404\n\n";
    return;
}

# Juan remove:
#open(NUMLINES,"wc -l $fname |");
#$numlines = ;
#($numlines,$bar) = split(" DirLists",$numlines);
#close(NUMLINES);
# end Juan remove

$line = int(rand($numlines))+1;

for($i=1; $i $im_dir$im_file";
</pre>

  <p><strong><a name="ubuntu">UBUNTU CONFIGURATION (thanks to Daniel Munoz for these instructions)</a></strong></p>
  <p>1. Install "Apache" and "Perl" and configure.</p>

<pre>
apt-get install apache2
apt-get install libapache2-mod-perl2
a2enmod include
a2enmod rewrite
</pre>

  <p>2. Edit /etc/apache2/sites-available/default so that the
  following is the only <code>&lt;Directory&gt;</code> element in the
  file (change REPLACE_WITH_YOUR_LOCATION with the directory location
  of the LabelMe annotation tool code, e.g. /var/www/LabelMe-1-113):

<pre>
&lt;Directory "REPLACE_WITH_YOUR_LOCATION"&gt;
  Options Indexes FollowSymLinks MultiViews +Includes
  AllowOverride all
  Order allow,deny
  allow from all
  AddType text/html .shtml
  AddOutputFilter INCLUDES .shtml
  DirectoryIndex index.shtml
&lt;/Directory&gt;
</pre>

  <p><strong>CITATION</strong></p>
  <p>
B. C. Russell, A. Torralba, K. P. Murphy, W. T. Freeman, <i>LabelMe: a database and web-based tool for image annotation</i>. International Journal of Computer Vision, pages 157-173, Volume 77, Numbers 1-3, May, 2008.
<a href="http://people.csail.mit.edu/brussell/research/AIM-2005-025-new.pdf"><em>PDF</em></a></p>
<p>
<font size="2">&copy; 2005, MIT Computer Science and Artificial Intelligence Laboratory</font>
<br />
  <font color="#000000" size="2">With contributions from Samuel Davies, Erica 
    Cooper, Juventino Mejia, Anna Ayuso</font></p>

  </div>
</body>
</html>
